#include <iostream>
#include <cstring>
#include <algorithm>
#include <queue>

using namespace std;

const int N = 110;

int n, m;

int main()
{
    cin >> n >> m;

    queue<int> q;
    for (int i = 1; i <= n; i ++ ) q.push(i);

    while (m -- )
    {
        int a;
        cin >> a;
        a %= q.size();

        for (int i = 0; i < a; i ++ )
        {
            q.push(q.front());
            q.pop();
        }

        cout << q.front() << ' ';
        q.pop();
    }

    return 0;
}